import { defineConfig, loadEnv } from 'vite'
import viteBaseConfig from './vite.base.config'
import viteDevConfig from './vite.dev.config'
import viteProdConfig from './vite.prod.config'


const envResolver = {
  "build": () => {
    console.info("生产模式");
    return Object.assign({}, viteBaseConfig, viteProdConfig)
  },
  "serve": () => {
    console.info('开发模式');
    return Object.assign({}, viteBaseConfig, viteDevConfig)
  }
}

export default defineConfig(({ command, mode, ssrBuild }) => {
  return envResolver[command]();
});